<template>
  <div>
 <el-table
    :data="order"
    border
    style="width: 100%"
    row-class-name="tableRowClassName">
     <el-table-column
      prop="payTime"
      label="订单支付时间"
      width="180">
    </el-table-column>
    <el-table-column
      prop="status"
      label="订单状态"
       width="180">
    </el-table-column>
     <el-table-column
      prop="totalPrice"
      label="订单总价">
    </el-table-column>
     <el-table-column label="操作">
      <template slot-scope="scope">
        <el-button
          size="mini"
          @click="orderMsg(scope.row)">订单详情</el-button>
      </template>
    </el-table-column>
  </el-table><div v-if="open">
  <div>{{tip}}</div></div>
  </div>
</template>

<script>
import Vue from 'vue'
export default {
  name:'',
  data () {
    return {
      tip:'',
        order:[],
        open:true
    }
  },
  created () {

  },
  mounted () {
    this.findAll()
  },
  methods: {
    findAll(){
      Vue.axios.post('http://localhost:8088/order/findAll').then(res=>{
        if(res.data.code==0){
          this.open=true
          this.order=res.data.data
        }
        else{
            this.open=false;
            this.tip="无订单"
        }
      })
    },
    orderMsg(row){
           this.$router.push({name:"orderMsg",params:{uuid:row.uuid,status:row.status,totalPrice:row.totalPrice}})
    }
  }
}
</script>
